<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>侦听器-侦听数组变化（更新操作）</title>
  <script src="vue.js"></script>
</head>
<body>
  <script>
    let vm = new Vue({
      data: {
        array: [0, 1, 2, {x:1}]
      },
      watch: {
        array(newValue) {
          console.log('array变化为:');
          console.log(newValue);
        }
      }
    });
    vm.array.push(3); //可以被侦听到
  </script>
</body>
</html>
